package com.qiantu.phone.ui.uiutil;

import android.text.TextUtils;

public enum DeviceType {
    ADJUST_LIGHT("adjustLight"),     //调光灯
    BREAKER_LIGHT("breaker_light"),     // 开光
    ADJUST_COLOR("adjustcolor"),     // 调色灯
    TCT_DL("tctdl"),   // 色温灯
    ADJUST_LCT("adjustLCT"),   // 色温灯
    CURTAIN("curtain"),
    ROLLER_SHUTTER("rollershutter"),     // 卷帘
    WINDOW_CURTAINS("windowcurtains"),    // 开合帘
    BOFU_CURTAINS("bofu_windowcurtains"),    // 开合帘
    AIR_CONDITIONER("airconditioner"), // 空调总类，可以通过type判断，方便规整空调
    HAILIN_AIR_CONDITIONER("hailin_airconditioner"),     // 海林空调
    DAJIN_AIR_CONDITIONER("dajin_airconditioner"),     // 大金空调
    YILIN_AIR_CONDITIONER("yilin_airconditioner"),    // 亿林空调
    RILI_AIR_CONDITIONER("rili_airconditioner"),    // 空调
    JOHNSON_AC("johnson_ac"),
    FLOOR_HEATING("floorheating"),     // 地暖总类，同空调总类
    HAILIN_FLOOR_HEATING("hailin_floor_heating"),     // 地暖
    YILIN_FLOOR_HEATING("yilin_floor_heating"),     // 地暖
    FRESHAIR("freshair"),     // 新风总类，同空调总类
    HUODESENG_FRESHAIR("huodeseng_freshair"),     // 新风
    LANSHE_FRESHAIR("lanshe_freshair"),     // 新风
    WIRELESS_433_KEY_1("wireless_433_key_1", "type:wireless_433|keynum:1|learn:wirelesslearn_433|ctrl:wirelessctrl_433"),     // 无线433_1
    WIRELESS_433_KEY_2("wireless_433_key_2", "type:wireless_433|keynum:2|learn:wirelesslearn_433|ctrl:wirelessctrl_433"),     // 无线433_2
    WIRELESS_433_KEY_3("wireless_433_key_3", "type:wireless_433|keynum:3|learn:wirelesslearn_433|ctrl:wirelessctrl_433|custom:1"),     // 无线433_3
    WIRELESS_433_KEY_7("wireless_433_key_7", "type:wireless_433|keynum:7|learn:wirelesslearn_433|ctrl:wirelessctrl_433"),     // 无线433_7
    WIRELESS_433_KEY_9("wireless_433_key_9", "type_d:wireless_433|keynum:9|learn:wirelesslearn_433|ctrl:wirelessctrl_433|custom:1"),     // 无线433_9
    WIRELESS_315_KEY_1("wireless_315_key_1", "type:wireless_315|keynum:1|learn:wirelesslearn_315|ctrl:wirelessctrl_315"),     // 无线315_1
    WIRELESS_315_KEY_2("wireless_315_key_2", "type:wireless_315|keynum:2|learn:wirelesslearn_315|ctrl:wirelessctrl_315"),     // 无线315_2
    WIRELESS_315_KEY_3("wireless_315_key_3", "type:wireless_315|keynum:3|learn:wirelesslearn_315|ctrl:wirelessctrl_315"),     // 无线315_3
    WIRELESS_315_KEY_7("wireless_315_key_7", "type:wireless_315|keynum:7|learn:wirelesslearn_315|ctrl:wirelessctrl_315"),     // 无线315_7
    WIRELESS_315_KEY_9("wireless_315_key_9", "type_d:wireless_315|keynum:9|learn:wirelesslearn_315|ctrl:wirelessctrl_315"),     // 无线315_9
    INFRARED_KEY_1("infra-red_key_1", "type:infrared|keynum:1|learn:irlearn|ctrl:irctrl"),     // 红外1
    INFRARED_KEY_2("infra-red_key_2", "type_d:infrared|keynum:2|learn:irlearn|ctrl:irctrl"),     // 红外2
    INFRARED_KEY_3("infra-red_key_3", "type_d:infrared|keynum:3|learn:irlearn|ctrl:irctrl|custom:1"),     // 红外3
    INFRARED_KEY_7("infra-red_key_7", "type:infrared|keynum:7|learn:irlearn|ctrl:irctrl"),     // 红外7
    INFRARED_KEY_9("infra-red_key_9", "type:infrared|keynum:9|learn:irlearn|ctrl:irctrl|custom:1"),     // 红外9
    WALL_SWITCH1("wall_switch1"),     // 前面开关1键
    WALL_SWITCH2("wall_switch2"),     // 前面开关2键
    WALL_SWITCH3("wall_switch3"),     // 前面开关3键
    WALL_SWITCH4("wall_switch4"),     // 前面开关4键
    WALL_SWITCH6("wall_switch6"),     // 前面开关6键
    WALL_SWITCH8("wall_switch8"),     // 前面开关8键
    WALL_SWITCH_J4("wall_switch_J4"),     // 前面开关8键
    WALL_SWITCH_J8("wall_switch_J8"),     // 前面开关8键
    WALL_SWITCH_S1("wall_switch_s1"),     // 前面开关2键
    WALL_SWITCH_S2("wall_switch_s2"),     // 前面开关2键
    WALL_SWITCH_S3("wall_switch_s3"),   // 前面开关3键
    WALL_SWITCH_S4("wall_switch_s4"),     // 前面开关4键
    WALL_SWITCH_S6("wall_switch_s6"),     // 前面开关6键

    HUMAN_BODY_SENSOR("human_body_sensor"),     // 人体感应
    HUMAN_BODY_SENSOR2("human_body_sensor2"),     // 人体感应
    HUMAN_BODY_SENSOR_RADAR("human_body_sensor_radar"),   // 人体存在感应
    XINYUE_MUSIC("xinyue_music"),     // 背景音乐
    UNIVERSAL_SEQUENCER("universal_sequencer"),
    UNIVERSAL_PROJECTOR("universal_projector"),
    UNIVERSAL_PLAYER("universal_player"),
    UNIVERSAL_PA("universal_pa"),
    AC_CAMERA("ac_camera");      //可视门铃

    public final String stringType;
    public final int intType;
    public final String info;

    DeviceType(String stringType) {
        this.stringType = stringType;
        this.intType = ordinal();
        info = "";
    }

    DeviceType(String stringType, String info) {
        this.stringType = stringType;
        this.intType = ordinal();
        this.info = info;
    }

    public String getDeviceTypeInfo(String key){
        if (TextUtils.isEmpty(info)){
            return "";
        }
        String info_fix = "|" + info + "|";
        int sIndex = info_fix.indexOf("|" + key + ":");
        if (sIndex<0){
            return "";
        }else {
            sIndex += key.length() + 2;
        }
        int eIndex = info_fix.indexOf("|", sIndex);
        return info_fix.substring(sIndex, eIndex);
    }
}
